﻿<Window x:Class="Sample.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
        xmlns:FsFlow="clr-namespace:FsFlow;assembly=FsFlow"
        Title="FsFlow Sample" Width="400" SizeToContent="Height"
        >
	<Window.DataContext>
		<Binding Path="Instance" Source="{StaticResource mainViewModel}"/>
	</Window.DataContext>
	<TabControl>
		<TabItem Header="BigIntCalc" DataContext="{Binding BigIntCalc}">
			<StackPanel Margin="5" VerticalAlignment="Center">
				<TextBox Text="{Binding Arg1.Value, UpdateSourceTrigger=PropertyChanged}" TextAlignment="Right" />
				<UniformGrid Columns="4" Margin="0,5,0,0">
					<RadioButton Content="a + b" IsChecked="{Binding Op[Add]}" />
					<RadioButton Content="a - b" IsChecked="{Binding Op[Subs]}" />
					<RadioButton Content="a * b" IsChecked="{Binding Op[Mult]}" />
					<RadioButton Content="a / b" IsChecked="{Binding Op[Div]}" />
				</UniformGrid>
				<TextBox Text="{Binding Arg2.Value, UpdateSourceTrigger=PropertyChanged}" TextAlignment="Right" Margin="0,5,0,0"/>
				<TextBlock Text="{Binding ErrOrEq.Value}" TextAlignment="Right" Margin="0,5,0,0"/>
				<TextBox Text="{Binding Result.Value}" IsReadOnly="True" TextAlignment="Right" Margin="0,5,0,0"/>
			</StackPanel>
		</TabItem>
		<TabItem Header="Selection" DataContext="{Binding Selection}">
			<UniformGrid Margin="5" Columns="2">
				<ListBox x:Name="listBox" Margin="0,0,2.5,0" ItemsSource="{Binding AllNums}" SelectionMode="Extended">
					<i:Interaction.Behaviors>
						<FsFlow:BindableSelectedItemsBehavior SelectedItems="{Binding SelectedNums}"/>
					</i:Interaction.Behaviors>
				</ListBox> 
				<StackPanel Margin="2.5,0,0,0">
					<TextBlock Text="Count:" />
					<TextBox Text="{Binding Count.Value}" IsReadOnly="True" Margin="0,5,0,0" />
					<TextBlock Text="Sum:" Margin="0,5,0,0" />
					<TextBox Text="{Binding Sum.Value}" IsReadOnly="True" Margin="0,5,0,0" />
					<TextBlock Text="Product:" Margin="0,5,0,0" />
					<TextBox Text="{Binding Product.Value}" IsReadOnly="True" Margin="0,5,0,0" />
				</StackPanel>
			</UniformGrid>
		</TabItem>

	</TabControl>
</Window>
